<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');
?>
<h1>Add Building</h1>

<?php

//get num_rows currently in buildings table
$building_name = mysql_real_escape_string(strip_tags($_POST['name']));
$abbreviation = mysql_real_escape_string(strip_tags($_POST['abbrev']));



//SQL insert statement
$query = "INSERT INTO buildings (id, building_name, abbreviation)
VALUES
('','$building_name','$abbreviation')";

$result = mysql_query($query);

//advise user of status of SQL query
if ($result)
{
	echo "<b>".stripslashes($building_name)."</b> has been successfully added!";
	echo "<br />";
}
else
{
	echo "<b>".stripslashes($building_name)."</b> was NOT able to be added at this time!";
	echo "<br />";
}

//close
mysql_close();

?>

<p>
	<a href="index.php">&lt;&lt; Back to Buildings Portal</a><br />
</p>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>